<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="css/index1.css" rel="stylesheet">
<script type="text/javascript" src="jquery/jquery-1.8.2.js"></script>
</head>
<body>
<form action="list" method="post">
标题：<input type="text" name="name" value="${name}">
频道：<select id="se1" name="cid">
	<option value="">=请选择=</option>
</select>
<button>搜索</button>
<input type="button" value="添加"  onclick="tian()">
	<table>
		<tr>
			<td>ID</td>
			<td>标题</td>
			<td>图片</td>
			<td>频道</td>
			<td>类别</td>
			<td>文章内容</td>
		</tr>
		<c:forEach items="${pg.list}" var="s">
			<tr>
				<td>${s.id}</td>
				<td>${s.title}</td>
				<td><img width="100px" src="<%=request.getContextPath() %>"+${s.picture}+""> </td>
				<td>${s.chname}</td>
				<td>${s.caname}</td>
				<td>${s.content}</td>
			</tr>
		</c:forEach>
		<jsp:include page="/jquery/page.jsp"></jsp:include>
	</table>
</form>

<script type="text/javascript">
var ss=${cid}
	$.post(
		"selectchannel",
		{},
		function (mas) {
			for (var i = 0; i < mas.length; i++) {
				if(mas[i].id==ss){
					$("#se1").append("<option selected value='"+mas[i].id+"'>"+mas[i].name+"</option>");
				}else{
					$("#se1").append("<option value='"+mas[i].id+"'>"+mas[i].name+"</option>")
				}
				
				
			}
		},
		"json"
	)
	
	function tian() {
		location="tianatr";
	}
	
	
	
</script>

</body>
</html>